package com.xiaoma.tpo.webservice;

import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;

import org.apache.commons.codec.digest.DigestUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.xiaoma.tpo.dao.ClsScoreDao;
import com.xiaoma.tpo.dao.ForumTopicDao;
import com.xiaoma.tpo.domain.Test;
import com.xiaoma.tpo.dto.BonusBoard;
import com.xiaoma.tpo.service.BonusPointService;
import com.xiaoma.tpo.service.TestService;
import com.xiaoma.verbal.service.PayAudioService;

@Controller
@RequestMapping("/test")
public class TestController {
    private Logger LOG = LoggerFactory.getLogger(TestController.class);
    @Autowired
    private TestService testService;
    
    @Autowired
    private BonusPointService bpService;
    
    @Autowired
    private ClsScoreDao scoreDao;
    
    @Autowired
    private PayAudioService payAudioService;
    
    @Autowired
    private ForumTopicDao fDao;
    
    @RequestMapping(value = "/1", method = RequestMethod.GET)
    @ResponseBody
    public String test(){
        System.out.println("test successful");
        LOG.info("test successful on {}", new Date());
        return "OK at " + new Date();
        
    }
    
    @RequestMapping(value = "/2", method = RequestMethod.GET)
    @ResponseBody
    public String test111(){
        System.out.println("Agents of S.H.I.E.L.D.");
        Test t = testService.findById(1);
        LOG.info("test successful on {}", new Date());
        return "welcome to S.H.I.E.L.D. Agent " + t.getName();
        
    }
    
    
    @RequestMapping(value = "/cc", method = RequestMethod.GET)
    @ResponseBody
    public String a(){
        List<?> list = testService.findU(20);
//        List<?> list = fDao.findJoinedTopics1(8756);
        System.out.println(list.size());
        return "ooooooo";
        
    }
    
    
    
    public static void main(String args[]) {
        String fixedVersion = "301";
        String version = "300";
      if (version.equalsIgnoreCase("3.0") || (Integer.parseInt(fixedVersion) > Integer.parseInt(version))) {
          System.out.println("xxxxx");
      }
        System.out.println(DigestUtils.md5Hex(fixedVersion));
    }
}
